import api from './api';
import { LlmModel, LlmModelCreateRequest, LlmModelUpdateRequest } from '../types';

export const llmModelService = {
  // 获取所有LLM模型
  async getLlmModels(): Promise<LlmModel[]> {
    const response = await api.get('/LlmModels');
    return response.data;
  },

  // 根据ID获取LLM模型
  async getLlmModel(id: number): Promise<LlmModel> {
    const response = await api.get(`/LlmModels/${id}`);
    return response.data;
  },

  // 创建LLM模型
  async createLlmModel(data: LlmModelCreateRequest): Promise<LlmModel> {
    const response = await api.post('/LlmModels', data);
    return response.data;
  },

  // 更新LLM模型
  async updateLlmModel(id: number, data: LlmModelUpdateRequest): Promise<void> {
    await api.put(`/LlmModels/${id}`, data);
  },

  // 删除LLM模型
  async deleteLlmModel(id: number): Promise<void> {
    await api.delete(`/LlmModels/${id}`);
  },

  // 切换LLM模型启用状态
  async toggleLlmModel(id: number): Promise<void> {
    await api.patch(`/LlmModels/${id}/toggle`);
  },
};
